<?php
namespace Application\Controller;

use Zend\Mvc\Controller\AbstractActionController;

class ImageController extends AbstractActionController
{

    public function getUserImageAction()
    {

        $request = $this->getRequest();
        $imageId = $request->getQuery('id');
        $fileDao = $this->getServiceLocator()->get('file');
	    $imageContent = $fileDao->getProfileImage($imageId);
		$imageContent=$imageContent['data'];
        $response = $this->getResponse();
        $response->setContent($imageContent);
        $response->getHeaders()
            ->addHeaderLine('Content-Transfer-Encoding', 'binary')
            ->addHeaderLine('Content-Type', 'image/png')
            ->addHeaderLine('Content-Transfer-Encoding', 'binary')
            ->addHeaderLine('Content-Length', mb_strlen($imageContent));
        return $response;

    }
}

?>
